package Year22_Month03.day06;

import java.util.Scanner;

public class Main1 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] arr = new int[n + 1];

        for (int i = 0; i < n; i++) {
            arr[i] = sc.nextInt();
        }
        int count = 0;
        int i = 0;
        while(i < n){
            //先来个非递减
            if(arr[i] < arr[i + 1]){
                while(i < n && arr[i] <= arr[i + 1]){
                    i++;
                }
                count++;

            }else if(arr[i] == arr[i + 1]){
                i++;
            }else{
                while(i < n  && arr[i] >= arr[i + 1]){
                    i++;
                }
                count++;

            }
        }
        System.out.println(count);
    }
}
